/* Replication file for "Understanding Ambivalent Sexism and its Relationship with Electoral Choice in Britain"

Date: 2nd September 2021
Any issues email: r.a.degeus@reading.ac.uk

BRITISH ELECTION STUDY DATA:
The data used is the W1-W19 British Election Study data-set which can be downloaded from the BES website. The data used here was downloaded on 20 June 2020 and contains only the variables required for the analyses included below.


==========================================
* Table of contents:
* 1 Load data and rename
* 2. Investigating scale properties
* 3. Descriptives (Figure 1; Table 2; Table 3; Table A1; A2)
* 4. Recoding for regression models
* 5. Predicting sexism (Figures 2a and 2b; Table A3)
* 6. Appendix models predicting sexism (Table A4)
* 7. EU referendum vote (Table A5' Figure 3)
* 8. Appendix models EU referendum vote (Table A6)
* 9. 2019 GE vote (Table A7; Figure 4A and 4b)
============================================
*/ 

*=========================================
* 1. Load data and rename variables
*=========================================

set maxvar 10000

* LOAD DATA 
*use "/Users/roosmarijndegeus/Dropbox (Personal)/Roos-Collaborations/Ambivalent sexism/Analysis/BES/Data/BES2019_W19_Panel_v0.2_June2020.dta", clear 
* use "C:\Users\Rosie\Dropbox\JEPOP 2019 gender gaps\Data\BES2019_W19_Panel_v0.2.dta"

set scheme s1mono 

gen appreciate = hostileSexism1W19
gen control = hostileSexism2W19
gen innocent = hostileSexism3W19
gen cherished = benevolentSexism1W19
gen purity = benevolentSexism2W19
gen pedestal = benevolentSexism3W19



*=========================================
* 2. Scale properties 
*=========================================
* note that in EPOP the items appreciate and pedestal are not included in benevolent

* Tab the DK replies (Appendix table A2)
tab appreciate
tab control
tab innocent
tab cherished
tab purity
tab pedestal

* compare DK rates with other variables
tab leftRightW19
tab generalElectionVoteW19
tab partyIdW19



* Factor analysis
factor appreciate control innocent cherished purity pedestal
loadingplot 
rotate 
loadingplot 

factor control innocent cherished purity  
loadingplot
rotate
loadingplot

* Cronbach's alpha
alpha appreciate control innocent
alpha cherished purity pedestal
alpha innocent control 
alpha cherished purity 
alpha appreciate control innocent cherished purity pedestal
alpha control innocent cherished purity 


* remove the DK 
foreach x in appreciate control innocent cherished purity pedestal {
recode `x' 9999 = .
}


* scale to range - 2 to +2 which is true in EPOP (positive values = high in sexism)
recode appreciate 1=-2 2=-1 3=0 4=1 5=2
recode control   1=-2 2=-1 3=0 4=1 5=2
recode innocent   1=-2 2=-1 3=0 4=1 5=2
recode cherished   1=-2 2=-1 3=0 4=1 5=2
recode purity   1=-2 2=-1 3=0 4=1 5=2
recode pedestal   1=-2 2=-1 3=0 4=1 5=2

* Create scales
* rowtotal 
egen hostile = rowtotal(innocent control appreciate), missing
egen benevolent = rowtotal(cherished purity pedestal), missing
egen benevolent_epop = rowtotal(cherished purity), missing
egen hostile_epop = rowtotal(innocent control), missing 

pwcorr hostile benevolent 
pwcorr hostile_epop benevolent_epop

* Recode -1 to +1 
gen hostile_rescale = hostile / 6
gen benevolent_rescale = benevolent/ 6
gen benevolent_epop_rescale = benevolent_epop  / 4
gen hostile_epop_rescale = hostile_epop / 4


* Correlation with authoritarianism 
pwcorr al_scaleW17 hostile_rescale
pwcorr al_scaleW17 benevolent_rescale


*=========================================
* 3. Descriptive Analyses
*=========================================


* Create DV variables
gen vote2019 = . 
replace vote2019 = 0 if generalElectionVoteW19 == 2
replace vote2019 = 1 if generalElectionVoteW19 == 1
label define vote2019_vote 0 "Labour" 1 "Conservative"
label values vote2019 vote2019_vote 

gen euvote = . 
	replace euvote = 0 if p_eurefvote == 0
	replace euvote = 1 if p_eurefvote == 1
	label define euvote_label 0 "Remain" 1 "Leave"
	label values euvote euvote_label 

* 2019 vote multiple categories 
gen votege_2019 = . 
replace votege_2019 = 1 if generalElectionVoteW19 == 1 
replace votege_2019 = 2 if generalElectionVoteW19 == 2
replace votege_2019 = 3 if generalElectionVoteW19 == 3 
replace votege_2019 = 4 if generalElectionVoteW19 == 4 | generalElectionVoteW19 == 5 | generalElectionVoteW19 == 6 | generalElectionVoteW19 == 7 | generalElectionVoteW19 == 9 | generalElectionVoteW19 == 12 | generalElectionVoteW19 == 13
label define vote_label 1 "Conservative" 2 "Labour" 3 "LibDem" 4 "Other"
label values votege_2019 vote_label




* Distribution data
histogram hostile_rescale, percent discrete
histogram benevolent_rescale, percent discrete 

* Figure 1: note the figure was made in excel 
tab hostile_rescale [iw=wt_new_W19_result]
tab benevolent_rescale [iw=wt_new_W19_result]

* Table 2: Intersection hostile and benevolent sexist attitudes in UK 
label define sexist_label 0 "neither" -1 "not sexist" 1 "sexist"
gen sexist_h = 1 if hostile_rescale > 0 
replace sexist_h = -1 if hostile_rescale < 0 
replace sexist_h = 0 if hostile_rescale == 0 
replace sexist_h = . if hostile_rescale == . 
label values sexist_h sexist_label 


gen sexist_b = 1 if benevolent_rescale > 0 
replace sexist_b = -1 if benevolent_rescale < 0 
replace sexist_b = 0 if benevolent_rescale == 0 
replace sexist_b = . if benevolent_rescale == . 
label values sexist_b sexist_label 

tabulate   sexist_b sexist_h [iw=wt_new_W19_result] , cell

* Sexist on both
tab gender if sexist_h == 1 & sexist_b == 1 [iw=wt_new_W19_result]
tab votege_2019 if sexist_h == 1 & sexist_b == 1 [iw=wt_new_W19_result]
tab euvote if sexist_h == 1 & sexist_b == 1 [iw=wt_new_W19_result]
mean (ageW19) if  sexist_h == 1 & sexist_b == 1 [iw=wt_new_W19_result]

* Sexist on neither
tab gender if sexist_h == -1 & sexist_b == -1 [iw=wt_new_W19_result]
tab votege_2019 if sexist_h == -1 & sexist_b == -1 [iw=wt_new_W19_result]
tab euvote if sexist_h == -1 & sexist_b == -1 [iw=wt_new_W19_result]
mean (ageW19) if  sexist_h == -1 & sexist_b == -1 [iw=wt_new_W19_result]

* hostile but not benevolent
tab gender if sexist_h == 1 & sexist_b == -1 [iw=wt_new_W19_result]
tab votege_2019 if sexist_h == 1 & sexist_b == -1 [iw=wt_new_W19_result]
tab euvote if sexist_h == 1 & sexist_b == -1 [iw=wt_new_W19_result]
mean (ageW19) if  sexist_h == 1 & sexist_b == -1 [iw=wt_new_W19_result]

* benevolent but not hostile 
tab gender if sexist_h == -1 & sexist_b == 1 [iw=wt_new_W19_result]
tab votege_2019 if sexist_h == -1 & sexist_b == 1 [iw=wt_new_W19_result]
tab euvote if sexist_h == -1 & sexist_b == 1 [iw=wt_new_W19_result]
mean (ageW19) if  sexist_h == -1 & sexist_b == 1 [iw=wt_new_W19_result]

* age plots - Figure A1 
* Age dummies 	
gen age_dummy = . 
replace age_dummy = 1 if ageW19 >= 18 & ageW19 <= 25
replace age_dummy = 2 if ageW19 > 25 & ageW19 <= 45
replace age_dummy = 3 if ageW19 > 45 & ageW19 <= 65
replace age_dummy = 4 if ageW19 > 65
replace age_dummy = . if ageW19 == .

label define age_dummy_label 1 "18-25" 2 "25-45" 3 "45-65" 4 "65+"
label values age_dummy age_dummy_label 
histogram hostile_rescale, discrete percent by(age_dummy)
histogram benevolent_rescale, discrete percent by(age_dummy)



* Table 3: BES Difference in means  
regress hostile_rescale i.gender [iweight=wt_new_W19_result]
regress benevolent_rescale i.gender [iweight=wt_new_W19_result]
regress hostile_rescale i.vote2019 [iweight=wt_new_W19_result]
regress benevolent_rescale i.vote2019 [iweight=wt_new_W19_result]
regress hostile_rescale i.euvote [iweight=wt_new_W19_result]
regress benevolent_rescale i.euvote [iweight=wt_new_W19_result]


*** Descriptives Sample **** (Table A1)
tab gender if hostile_rescale != . & benevolent_rescale != . 
sum ageW19 if hostile_rescale != . & benevolent_rescale != . 
tab p_edlevelW19 if hostile_rescale != . & benevolent_rescale != . 
tab p_religionW17 if hostile_rescale != . & benevolent_rescale != . 
tab p_gross_householdW19 if hostile_rescale != . & benevolent_rescale != . 
tab ns_sec_analyticW19 if hostile_rescale != . & benevolent_rescale != . 
tab workingStatusW19 if hostile_rescale != . & benevolent_rescale != . 
tab p_maritalW19 if hostile_rescale != . & benevolent_rescale != . 
tab euvote if hostile_rescale != . & benevolent_rescale != . 
tab generalElectionVoteW19 if hostile_rescale != . & benevolent_rescale != . 

 
*=================================================
* 4. Recoding regression models 
*=================================================
estimates clear

* regression recoding
tab lr_scaleW17  
tab gender
tab ageW19 


* income (remove DK and prefer not to answer)
recode p_gross_householdW19 16 = . 17 = . 

* ethnicity = white 
gen white = . 
replace white = 1 if p_ethnicityW19 == 1 | p_ethnicityW19 == 2
replace white = 0 if p_ethnicityW19 > 2 & p_ethnicityW19 < 16 

* Religion, collapse into 3 categories (removing prefer not to say)
gen religion = . 
replace religion = 0 if p_religionW19 == 1 
replace religion = 1 if p_religionW19 == 2
replace religion = 2 if p_religionW19 > 2 & p_religionW19 < 20 
replace religion = . if p_religionW19 == 19 
label define religion_label 0 "Not religious" 1 "Religious - CofE" 2 "Religious - Other"
label values religion religion_label 

* Marital status collapsing 
gen married = p_maritalW19 
recode married 3=1 4=2 5=2 

label define maritallabel 1 "Married" 2 "Partner" 6 "Single" 7 "Divorced" 8 "Widowed"
label values married maritallabel 

* Collapsing occupation categories from 8 to 5 
* see here for justification: https://www.ons.gov.uk/methodology/classificationsandstandards/otherclassifications/thenationalstatisticssocioeconomicclassificationnssecrebasedonsoc2010

gen occupation = . 
replace occupation = 1 if ns_sec_analyticW19 == 11 | ns_sec_analyticW19 == 12 | ns_sec_analyticW19 == 20
replace occupation = 2 if ns_sec_analyticW19 == 30 
replace occupation = 3 if ns_sec_analyticW19 == 40
replace occupation = 4 if ns_sec_analyticW19 == 50 
replace occupation = 5 if ns_sec_analyticW19 == 60 | ns_sec_analyticW19 == 70

label define occupation_label 1 "Higher manag/professional" 2 "Intermediate" 3 "Small empl/own account" 4 "Lower supervisory/technical" 5 "Semi-routine/routine"
label values occupation occupation_label
 

* Work-status (grouping two versions of parttime; grouping all students)
gen workstatus = workingStatusW19
recode workstatus 3=2 6=5 9 = . 
label define workstatus_label 1 "Fulltime" 2 "Part-time" 4 "Unemployed" 5 "Student" 7 "Retired" 8 "Not in Paid Work" 
label values workstatus workstatus_label 

* Sexual orientation 
gen sexuality = . 
replace sexuality = 0 if p_sexualityW19 == 1
replace sexuality = 1 if p_sexualityW19 == 2 | p_sexualityW19 == 3 | p_sexualityW19 == 4 
replace sexuality = 2 if p_sexualityW19 == 5 

label define sexuality_label 0 "Heterosexual" 1 "LGB+" 2 "Prefer not to say"
label values sexuality sexuality_label 

* Immigration attitudes
tab immigEconW17 if hostile_rescale != . & benevolent_rescale != . & gender != . & ageW19 != . & religion != . & p_edlevelW19 != . ///
	& occupation != . & workstatus != . & married != . & lr_scaleW17 != . & al_scaleW17 != . & generalElectionVoteW19!=. & euvote !=.
gen immigration_econ = immigEconW17
replace immigration_econ=. if immigration_econ==9999
label values immigration_econ immigEcon

tab immigCulturalW17 if hostile_rescale != . & benevolent_rescale != . & gender != . & ageW19 != . & religion != . & p_edlevelW19 != . ///
	& occupation != . & workstatus != . & married != . & lr_scaleW17 != . & al_scaleW17 != . & generalElectionVoteW19!=. & euvote !=.
gen immigration_cultural = immigCulturalW17
replace immigration_cultural=. if immigration_cultural==9999
label values immigration_cultural immigCult

* English identity
gen englishidentity = englishnessW16
replace englishidentity = englishnessW15 if englishidentity==.
replace englishidentity = englishnessW14 if englishidentity==.
replace englishidentity=. if englishidentity==9999
tab englishidentity if hostile_rescale != . & benevolent_rescale != . & gender != . & ageW19 != . & religion != . & p_edlevelW19 != . ///
	& occupation != . & workstatus != . & married != . & lr_scaleW17 != . & al_scaleW17 != . & generalElectionVoteW19!=. & euvote !=.
label values englishidentity english

* Equal opportunities for ethnic minorities gone too far
tab blackEqualityW17 if hostile_rescale != . & benevolent_rescale != . & gender != . & ageW19 != . & religion != . & p_edlevelW19 != . ///
	& occupation != . & workstatus != . & married != . & lr_scaleW17 != . & al_scaleW17 != . & generalElectionVoteW19!=. & euvote!=.
replace blackEqualityW17=. if blackEqualityW17==9999

* Equal opportunities for women gone too far
tab femaleEqualityW17 if hostile_rescale != . & benevolent_rescale != . & gender != . & ageW19 != . & religion != . & p_edlevelW19 != . ///
	& occupation != . & workstatus != . & married != . & lr_scaleW17 != . & al_scaleW17 != . & generalElectionVoteW19!=. & euvote !=.
replace femaleEqualityW17=. if femaleEqualityW17==9999

* Equal opportunities for gays gone too far 
tab gayEqualityW17 if hostile_rescale != . & benevolent_rescale != . & gender != . & ageW19 != . & religion != . & p_edlevelW19 != . ///
	& occupation != . & workstatus != . & married != . & lr_scaleW17 != . & al_scaleW17 != . & generalElectionVoteW19!=. & euvote !=.
replace gayEqualityW17=. if gayEqualityW17==9999

* Child-rearing (authoritarianism)
replace auth1W19=. if auth1W19==9999
replace auth2W19=. if auth2W19==9999
replace auth4W19=. if auth4W19==9999
replace auth5W19=. if auth5W19==9999
tab auth5W19 if hostile_rescale != . & benevolent_rescale != . & gender != . & ageW19 != . & religion != . & p_edlevelW19 != . ///
	& occupation != . & workstatus != . & married != . & lr_scaleW17 != . & al_scaleW17 != . & generalElectionVoteW19!=. & euvote !=.
	
	
* it seems that the labelling for auth4W19 is incorrect
label define autho_label 1 "Curious" 2 "Good manners"
label values auth4W19 autho_label 	
	
* Religion - catholics
gen religion2 = . 
replace religion2 = 0 if p_religionW19 == 1 
replace religion2 = 1 if p_religionW19 == 2
replace religion2 = 2 if p_religionW19 == 3 
replace religion2 = 3 if p_religionW19 > 3 & p_religionW19 < 20 
replace religion2 = . if p_religionW19 == 19 
label define religion_label2 0 "Not religious" 1 "Religious - CofE"  2 "Religious - Catholic" 3 "Religious - Other"
label values religion2 religion_label2 

gen catholic_dummy = .
replace catholic_dummy = 1 if religion2 == 1
replace catholic_dummy = 2 if religion2 == 2 
ttest hostile_rescale, by(catholic_dummy)
ttest benevolent_rescale, by(catholic_dummy)

ttest benevolent_rescale, by(catholic_dummy)



*============================================================================
* 5. Predicting Sexism (Figures 2a and 2b); Table A3
*============================================================================
 * Hostile 
estimates clear 
regress hostile_rescale i.gender if age_dummy != . & p_edlevelW19 != . & occupation != . & workstatus != . & married != . & lr_scaleW17 != . & al_scaleW17 != . & religion2 != .  [iw=wt_new_W19_result]
estimates store m1_h

regress hostile_rescale i.gender i.age_dummy i.p_edlevelW19 i.religion2 i.occupation i.workstatus i.married  if  lr_scaleW17 != . & al_scaleW17 != . [iw=wt_new_W19_result]
estimates store m2_h

regress hostile_rescale i.gender i.age_dummy  i.p_edlevelW19 i.religion2 i.occupation i.workstatus i.married  lr_scaleW17 al_scaleW17 [iw=wt_new_W19_result]
estimates store m3_h

* Figure 2A 
* Coefplot Hostile sexism - note subgraph titles are set to medium small ; main title is medium; y-axis is small 
coefplot (m2_h), scheme(s1mono) xline(0) drop(_cons)  nobase headings( 2.age_dummy="{bf:Age}" 1.p_edlevelW19="{bf:Education}" 1.religion2="{bf:Religion}" 2.occupation="{bf:Occupation}" 2.workstatus="{bf:Working Status}" 2.married="{bf:Marital Status}") saving(hostile_dem.gph, replace)


coefplot (m3_h), scheme(s1mono) xline(0) drop(_cons)  nobase headings( 2.age_dummy="{bf:Age}"  1.p_edlevelW19="{bf:Education}" 1.religion2="{bf:Religion}" 2.occupation="{bf:Occupation}" 2.workstatus="{bf:Working Status}" 2.married="{bf:Marital Status}" lr_scaleW17="{bf:Political Attitudes}") saving(hostile_att.gph, replace)

graph combine hostile_dem.gph hostile_att.gph, xcommon row(1)


* Benevolent 
regress benevolent_rescale i.gender if age_dummy  != . & p_edlevelW19 != . & occupation != . & workstatus != . & married != . & lr_scaleW17 != . & al_scaleW17 != . & religion2 !=. [iw=wt_new_W19_result]
estimates store m1_b


regress benevolent_rescale i.gender i.age_dummy  i.p_edlevelW19 i.religion2 i.occupation i.workstatus i.married   if  lr_scaleW17 != . & al_scaleW17 != . [iw=wt_new_W19_result]
estimates store m2_b


regress benevolent_rescale i.gender i.age_dummy  i.p_edlevelW19 i.religion2 i.occupation i.workstatus i.married  lr_scaleW17 al_scaleW17 [iw=wt_new_W19_result]
estimates store m3_b

* Table A3 Supplement
esttab m1_h m2_h m3_h m1_b m2_b m3_b using "predict_sexism.rtf", b(2) se label nobase replace 



* Figure 2B Coefplot Benevolent sexism
coefplot (m2_b), scheme(s1mono) xline(0) drop(_cons)  nobase headings( 2.age_dummy="{bf:Age}" 1.p_edlevelW19="{bf:Education}" 1.religion2="{bf:Religion}" 2.occupation="{bf:Occupation}" 2.workstatus="{bf:Working Status}" 2.married="{bf:Marital Status}") saving(benevolent_dem.gph, replace)


coefplot (m3_b), scheme(s1mono) xline(0) drop(_cons)  nobase headings( 2.age_dummy="{bf:Age}"  1.p_edlevelW19="{bf:Education}" 1.religion2="{bf:Religion}" 2.occupation="{bf:Occupation}" 2.workstatus="{bf:Working Status}" 2.married="{bf:Marital Status}" lr_scaleW17="{bf:Political Attitudes}") saving(benevolent_att.gph, replace)

graph combine benevolent_dem.gph benevolent_att.gph, xcommon row(1)




*=====================================================
* 6. Supplementary models predicting sexism - table A4
* ===================================================

* robustness check: sexuality- table A4 supplement 
estimates clear 
regress hostile_rescale i.gender i.age_dummy i.p_edlevelW19 i.religion2 i.occupation i.workstatus i.married i.sexuality lr_scaleW17 al_scaleW17 [iw=wt_new_W19_result]
estimates store hostile_sexuality 

regress benevolent_rescale i.gender i.age_dummy  i.p_edlevelW19 i.religion2 i.occupation i.workstatus i.married  i.sexuality lr_scaleW17 al_scaleW17 [iw=wt_new_W19_result]
estimates store benevolent_sexuality

esttab hostile_sexuality benevolent_sexuality using "sexuality.rtf", b(2) se label nobase replace 

* robustness check region - available upon request 
regress hostile_rescale i.gender i.age_dummy  i.p_edlevelW19 i.religion2 i.occupation i.workstatus i.married i.gorW19  lr_scaleW17 al_scaleW17 [iw=wt_new_W19_result]

regress benevolent_rescale i.gender i.age_dummy  i.p_edlevelW19 i.religion2 i.occupation i.workstatus i.married i.gorW19  lr_scaleW17 al_scaleW17 [iw=wt_new_W19_result]


* ====================================================
* 7. EU - Referendum Models (Table A5; Figure 3)
* ====================================================
pwcorr hostile_rescale benevolent_rescale femaleEqualityW17, sig 

* sexist attitudes only
estimates clear 
logit euvote c.hostile_rescale c.benevolent_rescale if gender != . & age_dummy != . & p_edlevelW19 != . &  religion2 != . & ///
	occupation != . &  workstatus != . &  married != . &  lr_scaleW17 != . & al_scaleW17 != . & immigration_econ != . &  immigration_cultural != . & ///
	englishidentity != . & ///
	blackEqualityW17 != . & femaleEqualityW17 != . & gayEqualityW17 != . [iw=wt_new_W19_result]
	estimates store m1

* demographics 
	logit euvote c.hostile_rescale c.benevolent_rescale i.gender i.age_dummy  i.p_edlevelW19 i.religion2 ///
	i.occupation  i.workstatus i.married if  lr_scaleW17 != . & al_scaleW17 != . & immigration_econ != . & immigration_cultural != . & ///
	englishidentity != . & ///
	blackEqualityW17 != . & femaleEqualityW17 != . & gayEqualityW17 != . [iw=wt_new_W19_result]
	estimates store m2 
	
	
* all controls 
logit euvote c.hostile_rescale c.benevolent_rescale i.gender i.age_dummy  i.p_edlevelW19 i.religion2 ///
	i.occupation  i.workstatus i.married  lr_scaleW17 al_scaleW17 c.immigration_econ c.immigration_cultural ///
	c.englishidentity ///
	i.blackEqualityW17 i.femaleEqualityW17 i.gayEqualityW17 [iw=wt_new_W19_result]
	estimates store m3
	
	* Table A5 supplement 
	esttab m1 m2 m3 using "EUrefvote.rtf", b(2) se nobase label replace 


	
	
* Figure 3: Marginsplots
* run code for M1 and then M3 and then run the graphs change the titles 
margins , at(hostile_rescale=(-1(0.25)1))
marginsplot, name(hostile_controls, replace) title("All Controls") ytitle("predicted probability of voting Leave") xtitle("Hostile sexism") scheme(s1mono)

margins, at(benevolent_rescale=(-1(0.25)1))
marginsplot, name(benevolent_controls, replace) title("All Controls") ytitle("predicted probability of voting Leave") xtitle("Benevolent sexism") scheme(s1mono)


graph combine hostile  hostile_dem hostile_controls benevolent benevolent_dem benevolent_controls, ycommon scheme(s1mono)


* =======================================================================		
* 8. Robustness check EU vote model: vote intention (Table A6)
* =======================================================================
gen euvote_intention = . 
replace euvote_intention = 0 if euRefVoteW19 == 0
replace euvote_intention = 1 if euRefVoteW19 == 1 
label define euvote 0 "Remain" 1 "Leave"
label values euvote_intention euvote 
	
* sexist attitudes only
estimates clear 
logit euvote_intention c.hostile_rescale c.benevolent_rescale if gender != . & age_dummy != . & p_edlevelW19 != . &  religion2 != . & ///
	occupation != . &  workstatus != . &  married != . &  lr_scaleW17 != . & al_scaleW17 != . & immigration_econ != . &  immigration_cultural != . & ///
	englishidentity != . & ///
	blackEqualityW17 != . & femaleEqualityW17 != . & gayEqualityW17 != . [iw=wt_new_W19_result]
	estimates store m1

* demographics 
	logit euvote_intention c.hostile_rescale c.benevolent_rescale i.gender i.age_dummy  i.p_edlevelW19 i.religion2 ///
	i.occupation  i.workstatus i.married if  lr_scaleW17 != . & al_scaleW17 != . & immigration_econ != . & immigration_cultural != . & ///
	englishidentity != . & ///
	blackEqualityW17 != . & femaleEqualityW17 != . & gayEqualityW17 != . [iw=wt_new_W19_result]
	estimates store m2 
	
	
* all controls 
logit euvote_intention c.hostile_rescale c.benevolent_rescale i.gender i.age_dummy  i.p_edlevelW19 i.religion2 ///
	i.occupation  i.workstatus i.married  lr_scaleW17 al_scaleW17 c.immigration_econ c.immigration_cultural ///
	c.englishidentity ///
	i.blackEqualityW17 i.femaleEqualityW17 i.gayEqualityW17 [iw=wt_new_W19_result]
	estimates store m3
	
	esttab m1 m2 m3 using "EU_voteintention.rtf", b(2) se nobase label replace 
	
	
	
* ==================================================		
* 9. 2019 GE models (Table A7; Figure 4a and 4b)
* ==================================================	
* I think here use W19_result bc that is weighted for the 2019 general election results 

estimates clear 
* sexist attitudes only 
mlogit votege_2019 c.hostile_rescale c.benevolent_rescale if gender != . &  age_dummy != . &  p_edlevelW19 != . &  religion2 != . & ///
	occupation != . &  workstatus != . & married != . &  lr_scaleW17 != . & al_scaleW17!= . & euvote != . & immigration_econ != . & immigration_cultural != . & /// 
	englishidentity != . & blackEqualityW17 != . & femaleEqualityW17 != . & gayEqualityW17 != . [iw=wt_new_W19_result]
	estimates store m1

* demographics
mlogit votege_2019 c.hostile_rescale c.benevolent_rescale  i.gender i.age_dummy   i.p_edlevelW19  i.religion2 i.occupation  i.workstatus i.married  if  lr_scaleW17 != . & al_scaleW17!= . & euvote != . & immigration_econ != . & immigration_cultural != . & /// 
	englishidentity != . & blackEqualityW17 != . & femaleEqualityW17 != . & gayEqualityW17 != . [iw=wt_new_W19_result] 
	estimates store m2 

* all controls 
mlogit votege_2019 c.hostile_rescale c.benevolent_rescale i.gender i.age_dummy  i.p_edlevelW19 i.religion2 ///
	i.occupation  i.workstatus i.married  lr_scaleW17 al_scaleW17 i.euvote c.immigration_econ c.immigration_cultural /// 
	c.englishidentity i.blackEqualityW17 i.femaleEqualityW17 i.gayEqualityW17    [iw=wt_new_W19_result]
	estimates store m3
	
	
* Table A7 Supplement	
esttab m1 m2 m3 using "gevote_additions.rtf", b(2) se nobase label replace 

* Figure 4A and 4B  
* run M1, M2 and M3 and then afterwards run this code
margins, at(hostile=(-1(0.25)1)) predict(outcome(1))
marginsplot, name(hostile_con_all, replace) title("All Controls") ytitle("predicted probability of voting Conservative") xtitle("Hostile sexism") scheme(s1mono)

margins, at(benevolent=(-1(0.25)1)) predict(outcome(1))
marginsplot, name(benevolent_con_all, replace) title("All Controls") ytitle("predicted probability of voting Conservative") xtitle("Benevolent sexism") scheme(s1mono)


margins, at(hostile=(-1(0.25)1)) predict(outcome(2))
marginsplot, name(hostile_lab_all, replace) title("All Controls") ytitle("predicted probability of voting Labour") xtitle("Hostile sexism") scheme(s1mono)

margins, at(benevolent=(-1(0.25)1)) predict(outcome(2))
marginsplot, name(benevolent_lab_all, replace) title("All Controls") ytitle("predicted probability of voting Labour") xtitle("Benevolent sexism") scheme(s1mono)

* Hostile sexism
graph combine hostile_con  hostile_con_dem  hostile_con_all hostile_lab hostile_lab_dem hostile_lab_all, ycommon scheme(s1mono)


* Benevolent sexism
graph combine benevolent_con  benevolent_con_dem benevolent_con_all   benevolent_lab benevolent_lab_dem benevolent_lab_all, ycommon scheme(s1mono)
